package cn.tedu.csmall.controller;

import cn.tedu.csmall.pojo.stock.dto.StockReduceCountDTO;
import cn.tedu.csmall.restful.JsonResult;
import cn.tedu.csmall.service.IStockService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "库存模块")
@RequestMapping("/base/stock")
public class StockController {
    @Autowired
    private IStockService stockService;


    @PostMapping("/reduce/count")
    @ApiOperation("减少商品库存")
    public JsonResult reduceCommodityCount(StockReduceCountDTO stockReduceCountDTO) {
        stockService.reduceStockByCommodityCode(stockReduceCountDTO);
        return JsonResult.ok("减少商品库存完成！");
    }
}
